<?php 
class friend_controller extends CI_Controller
{
	function __construct()
	{
		parent::__construct();
		$this->load->model('friend_model');
		$temp = $this->session->userdata('is_logged_in');
		if(!isset($temp) || !$temp) exit('No direct script access allowed');
	}
	
	function view_my_friends()
	{
		$data['rows'] = $this->friend_model->ChangeQueryResultToArray(
				$this->friend_model->get_my_friends());
		$data['title']='My Friends';
		$data['id']='';
			$this->load->view('header',$data);
			$this->load->view('show_friend_view', $data);
		$this->load->view('footer',$data);
	}
	
	/*function confirm_friend()
	{
		$friendid = $this->input->get('friendid');
		$whereiam = $this->input->get('whereiam');
		$this->friend_model->confirm_friend($friendid);
		redirect($whereiam);
	}*/
	
	function delete_friend()
	{
		$friendid = $this->input->get('friendID');
		$this->friend_model->delete_friend($friendid);
		redirect('user_controller/show_user_profile?userID='.$friendid);
	}
	
	function add_as_friend()
	{
		$friendid = $this->input->get('friendID');
		$this->friend_model->add_friend($friendid );
		redirect('user_controller/show_user_profile?userID='.$friendid);
	}

}
?>
